﻿using FluentResourceMapping.Tests.TestDummies;
using NUnit.Framework;

// ReSharper disable InconsistentNaming

namespace FluentResourceMapping.Tests
{
    [TestFixture]
    public class ResourceMappingTests
    {
        private ResourceMappingModel model;

        [SetUp]
        public void Setup()
        {
            model = Fluently.Configure()
                .Mappings(o => o.TypeResourceMappings.Add(typeof (TestClassMap)))
                .BuildResourceMappingModel();
        }

        [Test]
        public void Can_Find_Mapping()
        {
            // Act
            var target = model.FindMapping(typeof (TestClass));

            // Assert
            Assert.IsNotNull(target);
        }

        [Test]
        public void Can_Find_Mapping_With_Generic_Argument()
        {
            // Act
            var target = model.FindMapping<TestClass>();

            // Assert
            Assert.IsNotNull(target);
        }

        [Test]
        public void Can_Get_Resource()
        {
            // Arrange
            TypeResourceMapping mapping = model.FindMapping(typeof (TestClass));

            // Act
            string resultResource = mapping.GetResource("Name");

            // Assert
            Assert.AreEqual("Nome", resultResource);
        }

        [Test]
        public void Can_Get_Resource_For_Member()
        {
            // Arrange
            TypeResourceMapping mapping = model.FindMapping(typeof (TestClass));

            // Act
            string resultResource = mapping.GetResourceFor<TestClass>(o => o.Name);

            // Assert
            Assert.AreEqual("Nome", resultResource);
        }

        [Test]
        public void Can_Map_With_Resource_Type()
        {
            // Arrange
            TypeResourceMapping mapping = model.FindMapping(typeof (TestClass));

            // Act
            string resultResource = mapping.GetResource("Age");

            // Assert
            Assert.AreEqual("Idade", resultResource);
        }

        [Test]
        public void Can_Add_Fluent_Mapping_With_Strong_Type_Resource_Key()
        {
            // Arrange
            TypeResourceMapping mapping = model.FindMapping<TestClass>();

            // Act
            string resultResource = mapping.GetResource("LastName");

            // Assert
            Assert.AreEqual("Sobrenome", resultResource);
        }

        [Test]
        public void Can_Find_Manual_Mapping_Merged_With_Base_Manual_Mapping()
        {
        }

        [Test]
        public void Can_Find_Manual_Mapping_Merged_With_Base_Auto_Mapping()
        {
        }

        [Test]
        public void Can_Find_Auto_Mapping_Merged_With_Base_Manual_Mapping()
        {
        }

        [Test]
        public void Can_Find_Auto_Mapping_Merged_With_Base_Auto_Mapping()
        {
        }
    }
}

// ReSharper restore InconsistentNaming